/**
 * @author luoqingbo
 * @create 2024/4/25 10:38
 */
public class Leetcode2379 {
    public static void main(String[] args) {
        System.out.println(distanceTraveled(5,1));
    }
    public static int distanceTraveled(int mainTank, int additionalTank) {
        int res = 0;
        int used = 0;
        while (mainTank > 0) {
            mainTank--;
            res += 10;
            used++;
            if (used == 5 && additionalTank >= 1) {
                mainTank++;
                additionalTank--;
                used = 0;
            }
        }
        return res;
    }
}
